local Lua__haomai = fk.CreateSkill {
    name = "Lua__haomai",
    anim_type = "offensive",
    tags = {Skill.Switch},
  }
  
  
  Fk:loadTranslationTable{
    ["Lua__haomai"] = "豪迈",
    [":Lua__haomai"] = "转换技，​阳：当你使用【杀】指定目标后，你可以弃置一张牌并选择一项：1. 此【杀】的伤害+1；2. 此【杀】若被抵消，你摸两张牌；3. 此【杀】若造成了伤害，你回复1点体力。"..
    "阴：当其他角色对你使用【杀】时，你可以弃置一张牌并选择一项：1. 令此【杀】取消你的目标；2. 令此【杀】的使用者摸两张牌；3. 令此【杀】的使用者失去1点体力",
    ["#Lua__haomai-discard"] = "豪迈：你可以弃置一张牌并选择一项",
    ["Lua__haomai1"] = "令此【杀】取消你的目标",
    ["Lua__haomai2"] = "【杀】的使用者摸两张牌",
    ["Lua__haomai3"] = "【杀】的使用者失去1点体力",
    ["Lua__haomai1Y"] = "令此【杀】伤害+1。",
    ["Lua__haomai2Y"] = "【杀】被抵消你摸两张牌",
    ["Lua__haomai3Y"] = "【杀】造成了伤害你回血",
  }



  Lua__haomai:addEffect(fk.TargetConfirmed, {
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(Lua__haomai.name) and 
        player:getSwitchSkillState(Lua__haomai.name, false) == fk.SwitchYin and -- 阳状态
        data.card.trueName == "slash" and not player:isNude()
    end,
    
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local to_discard = room:askToDiscard(player, {
            min_num = 1,
            max_num = 1,
            cancelable = true,
            include_equip = true,
            prompt = "#Lua__haomai-discard",
            skill_name = Lua__haomai.name,
        })
        if #to_discard > 0 then
            event:setCostData(self, {card = to_discard[1]})
            return true
        end
    end,
    
    on_use = function(self, event, target, player, data)
        local choice = player.room:askToChoice(player, {
            choices = {"Lua__haomai1","Lua__haomai2","Lua__haomai3"},
            skill_name = Lua__haomai.name,
        })
        if choice == "Lua__haomai1" then
            data:cancelTarget(player)
        elseif choice == "Lua__haomai2" then
            data.from:drawCards(2, Lua__haomai.name)
        else
            Room:loseHp(data.from,1, Lua__haomai.name) 
        end
    end,
  })

  -- 成为非延时锦囊牌的目标时
  Lua__haomai:addEffect(fk.TargetSpecified, {
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(Lua__haomai.name) and 
        player:getSwitchSkillState(Lua__haomai.name, false) == fk.SwitchYang and -- 阴状态
        data.card.trueName == "slash" and not player:isNude()
    end,
    
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local to_discard = room:askToDiscard(player, {
            min_num = 1,
            max_num = 1,
            cancelable = true,
            include_equip = true,
            prompt = "#Lua__haomai-discard",
            skill_name = Lua__haomai.name,
        })
        if #to_discard > 0 then
            event:setCostData(self, {card = to_discard[1]})
            return true
        end
    end,
    
    on_use = function(self, event, target, player, data)
        local choice = {"Lua__haomai1Y","Lua__haomai2Y"}
        if player:isWounded() then
            table.insert(choice,"Lua__haomai3Y")
        end
        local choice = player.room:askToChoice(player, {
            choices = choice,
            skill_name = Lua__haomai.name,
        })
        if choice == "Lua__haomai1Y" then
            data.additionalDamage = (data.additionalDamage or 0) + 1
        elseif choice == "Lua__haomai2Y" then
            player.room:setCardMark(data.card, "haomai-inarea", 1)
        else
            player.room:setCardMark(data.card, "haomai2-inarea", 1)
        end
    end,
  })
  
  -- 阳：被红色牌指定为目标
  Lua__haomai:addEffect(fk.Damage, {
    is_delay_effect = true,
    mute = true,
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(Lua__haomai.name) and data.card and
        data.card.trueName == "slash" and data.card:getMark("haomai2-inarea") == 1
    end,
    on_use = function(self, event, target, player, data)

        player.room:recover {
            who = player,
            num = 1,
            skillName = Lua__haomai.name
          }
    end,
  })

  Lua__haomai:addEffect(fk.CardEffectCancelledOut, {
    is_delay_effect = true,
    mute = true,
    can_trigger = function(self, event, target, player, data)
      return target == player and player:hasSkill(Lua__haomai.name) and
        data.card.trueName == "slash" and data.card:getMark("haomai-inarea") == 1
    end,
    on_use = function(self, event, target, player, data)
        player.room:drawCards(player,2)
    end,
  })
  
  return Lua__haomai